<template>
  <div class="commodity">
    <div class="top" :style="{backgroundImage: `url(${list.info && list.info.poi_back_pic_url})`, }">
      <h2 v-for="(item, index) in list.info" :key="index">
        <div class="tu">
          <img :src="list.info && list.info.picUrl" alt="" />
        </div>
        <span>{{item.name}}</span>
      </h2>
      <div class="liebiao">
        <input type="text" placeholder="搜索" />
        <div>点餐</div>
        <div>评价</div>
        <div>商家</div>
      </div>
    </div>
    <div class="bottom">
      <div class="left">
        <ul  v-for="(item, index) in list.taglist" :key="index">
          <li @click="currentIndex = index"  class="cate">{{ item.name }} </li>
        </ul>
      </div>
      <div class="right">
        <div class="item" v-for="(item, index) in list.taglist && list.taglist[currentIndex].goodlist" :key="index" >
          <div class="zuo">
            <img :src="item.picture" alt="" />
          </div>
          <div class="you">
            <h3>{{ item.name }}</h3>
            <p>{{ item.bulletin }}</p>
            <div class="xia">
              <span>￥{{ item.min_price }}</span>
              <div>＋</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { waimai_info } from "../../api/index";
export default {
  data() {
    return {
      currentIndex: 0,
      list: {},
    };
  },
  mounted() {
    waimai_info({ id: this.$route.params.id }).then((res) => {
      if (res.data.code == 200) {
        this.list = res.data.shopinfo;
        console.log(this.list);
      } else {
        alert(res.data.msg);
        this.$router.go(-1);
      }
    });
  },
};
</script>

<style scoped>
.commodity{
   display: flex;
   flex-direction: column;
}
.top {
  overflow: hidden;
  background-size: cover;
  height: 200px;
  padding: 0 10px;
}
.top h2 {
  margin-top: 80px;
  display: flex;
  font-size: 22px;
  height: 40px;
  line-height: 40px;
  margin-bottom: 20px;
  color: white;
}
.top h2 .tu {
  height: 40px;
  width: 40px;
  border-radius: 50%;
  background-color: aqua;
  margin-right: 20px;
}
.top h2 .tu img {
  border-radius: 50%;
  height: 100%;
}
.top .liebiao {
  display: flex;
}
.top .liebiao input {
  width: 100px;
  height: 40px;
  outline: none;
  border: none;
  border-radius: 20px;
  font-size: 20px;
  font-weight: 700;
  line-height: 40px;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.5);
}
input::-webkit-input-placeholder {
  color: white;
}
.top .liebiao div {
  height: 40px;
  width: 60px;
  text-align: center;
  line-height: 40px;
  font-size: 20px;
  font-weight: 700;
  color: white;
}
.bottom {
    flex: 1;
  display: flex;
}
.bottom .left ul{
  list-style: none;
  width: 100px;
}
.bottom .left ul li {
  height: 50px;
  padding: 0 10px;
  font-size: 14px;
}
.bottom .right {
   overflow: auto;
}

.bottom .right .item {
  display: flex;
  margin-top: 10px;
}
.bottom .right .item .zuo {
  margin-top: 20px;
  margin-right: 10px;
  width: 100px;
}
.bottom .right .item img {
  width: 100%;
}
.bottom .right .item .you {
  width: 170px;
}

.bottom .right .item .you .xia {
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bottom .right .item .you .xia span {
  font-size: 20px;
  color: red;
}
.bottom .right .item .you .xia div {
  font-size: 24px;
  font-weight: 700;
  color: white;
  text-align: center;
  line-height: 26px;
  height: 30px;
  width: 30px;
  border-radius: 50%;
  background-color: limegreen;
}
</style>